package com.dragon.common.modules.uaa.web.models.params;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * @author Chris Chan
 * Create On 2025/7/29 下午7:58
 * Use for:
 * Explain:
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "用户名密码登录参数")
public class LoginByUsernamePasswordParam implements Serializable {
    @NotBlank(message = "用户名不能为空")
    @Size(min = 6, max = 20, message = "用户名长度必须在4到20之间")
    @Schema(description = "用户名", example = "admin")
    private String username;
    @NotBlank(message = "密码不能为空")
    @Size(min = 6, max = 20, message = "密码长度必须在6到20之间")
    @Schema(description = "密码", example = "123456")
    private String password;

    public static LoginByUsernamePasswordParam of(String username, String password) {
        return new LoginByUsernamePasswordParam(username, password);
    }
    public static LoginByUsernamePasswordParam create(String username, String password) {
        return new LoginByUsernamePasswordParam(username, password);
    }
}
